import type { ProColumns } from '@ant-design/pro-table';

export type columnsDataType = {
  daoName: string;
  serialNo: string;
  status: number;
  createTime: string;
  phone: string;
  daoCode: string;
  createBy: string;
  type: string;
};

const columnsData: ProColumns<columnsDataType>[] = [
  // 配置搜索框
  {
    title: 'DAO名称',
    dataIndex: 'daoName',
    hideInTable: true,
    fieldProps: {
      maxLength: 20,
    },
  },
  {
    title: 'DAO编码',
    dataIndex: 'serialNo',
    hideInTable: true,
    fieldProps: {
      maxLength: 20,
    },
  },
  {
    title: 'DAO状态',
    dataIndex: 'status',
    valueType: 'select',
    hideInTable: true,
    valueEnum: {
      0: {
        text: '未审核',
      },
      1: {
        text: '通过',
      },
      2: {
        text: '拒绝',
      },
    },
  },
  {
    title: '注册日期',
    dataIndex: 'createTime',
    valueType: 'dateRange',
    hideInTable: true,
    search: {
      transform: (value) => {
        return {
          startDate: value[0],
          endDate: value[1],
        };
      },
    },
  },

  // table里面的内容
  {
    title: '序号',
    dataIndex: 'order',
    valueType: 'indexBorder',
    hideInSearch: true,
    width: 50,
    fixed: 'left',
  },
  {
    title: 'DAO名称',
    dataIndex: 'daoName',
    hideInSearch: true,
    width: 160,
    fixed: 'left',
  },
  {
    title: 'DAO编号',
    dataIndex: 'serialNo',
    hideInSearch: true,
    width: 180,
  },
  {
    title: 'DAO英文名称',
    dataIndex: 'daoCode',
    hideInSearch: true,
    width: 160,
  },
  {
    title: '手机号',
    dataIndex: 'phone',
    hideInSearch: true,
    width: 200,
  },
  {
    title: 'DAO状态',
    dataIndex: 'status',
    valueType: 'select',
    hideInSearch: true,
    width: 100,
    valueEnum: {
      0: {
        text: '未审核',
        status: 'Default',
      },
      1: {
        text: '通过',
        status: 'Success',
      },
      2: {
        text: '拒绝',
        status: 'Error',
      },
    },
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    hideInSearch: true,
    width: 160,
  },
  {
    title: '操作',
    dataIndex: 'action',
    hideInSearch: true,
    width: 200,
    fixed: 'right',
  },
];

export default columnsData;
